﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SDL3;
using 飞机大战.core;

namespace 飞机大战.scene
{
    internal partial class SceneMain : Scene
    {

        public partial void RegisterObject(IObject object_)
        {
            objects_.Append(object_);
        }

        public override partial void Init()
        {
            backgroundDots_.Init(); // 初始化背景
        }

        public override partial void Clean()
        {
            // 统一清理场景中的物体
            objects_.RemoveAll(obj =>
            {
                obj.Clean();
                return obj.Is_dead; // 返回 true 表示要删除
            });
        }

        public override partial void HandleEvents(SDL.Event event_)
        {
            // 统一
        }

        public override partial void Render()
        {
            backgroundDots_.Render();
        }

        public override partial void Update(float dt)
        {
            backgroundDots_.Update(dt);
        }

        public partial SDL.FPoint WorldToScreen(SDL.FPoint position)
        {
            return position;
        }
    }
}
